<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\SerializedName;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity(repositoryClass="App\Repository\ProductRepository")
 * @ORM\Table(name="t_product")
 */
class Product implements \JsonSerializable
{
    /**
     * @SerializedName("id")
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(name="id", type="integer")
     */
    private $productId;

    /**
     * @SerializedName("name")
     * @ORM\Column(name="name", type="string", length=20)
     * @Assert\NotBlank(message="商品名称非法")
     */
    private $productName;

    /**
     * @SerializedName("price")
     * @ORM\Column(name="price", type="integer")
     */
    private $productPrice;

    public function getProductId(): ?int
    {
        return $this->productId;
    }

    public function getProductName(): ?string
    {
        return $this->productName;
    }


    public function setProductName(string $productName): self
    {
        $this->productName = $productName;

        return $this;
    }

    public function getProductPrice(): ?int
    {
        return $this->productPrice;
    }

    public function setProductPrice(int $productPrice): self
    {
        $this->productPrice = $productPrice;

        return $this;
    }

    public function jsonSerialize()
    {
        return get_object_vars($this);
    }
}
